import React from 'react';
import ReactDOM from 'react-dom';
import './style/index.css';
import App from './App.jsx';
import * as serviceWorker from './serviceWorker';
import { AppContainer } from 'react-hot-loader';
import 'lib-flexible'

//redux
import {Provider} from 'react-redux';
//引入store
import store from '@/store/index.js';

const render = (Component) => {
    ReactDOM.render(
        <Provider store={store}>
            <AppContainer>
                <Component/>
            </AppContainer>
        </Provider>,
        document.getElementById('root')
    );
};

//个人觉得 公用的App 组件迟早会有他的用处的
render(App);

// 模块热替换的 API
if (module.hot) {
    module.hot.accept('./App', () => {
        render(App)
    });
}

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
